package com.fc.push;

import org.springframework.stereotype.Component;

@Component
public class ServerConfig {
	
	private static String host;
	
	private static int hport;
	
	private static int tport;
	
	private static int connectTimeOut;
	
	private static int keepAliveInterval;
	
	private static int processors = 0;
	
	private static String monitorregisterurl = "";
	
	private static int monitorport= -1;
	
	private static String monitorhost="";
	
	
	
	
	public static String getMonitorhost() {
		return monitorhost;
	}

	public static void setMonitorhost(String monitorhost) {
		ServerConfig.monitorhost = monitorhost;
	}

	public static int getMonitorport() {
		return monitorport;
	}

	public static void setMonitorport(int monitorport) {
		ServerConfig.monitorport = monitorport;
	}


	public static String getMonitorregisterurl() {
		return monitorregisterurl;
	}

	public static void setMonitorregisterurl(String monitorregisterurl) {
		ServerConfig.monitorregisterurl = monitorregisterurl;
	}

	public static String getHost() {
		return host;
	}

	public static void setHost(String h) {
		ServerConfig.host = h;
	}
	
	public static int getHport() {
		return hport;
	}

	public static void setHport(int hport) {
		ServerConfig.hport = hport;
	}

	public static int getTport() {
		return tport;
	}

	public static void setTport(int tport) {
		ServerConfig.tport = tport;
	}

	public static int getConnectTimeOut() {
		return connectTimeOut;
	}

	public static void setConnectTimeOut(int cto) {
		ServerConfig.connectTimeOut = cto;
	}

	public static int getKeepAliveInterval() {
		return keepAliveInterval;
	}

	public static void setKeepAliveInterval(int kat) {
		ServerConfig.keepAliveInterval = kat;
	}

	public static int getProcessors(){
		if(processors == 0){
			processors = Runtime.getRuntime().availableProcessors();
		}
		return processors;
	}
	
	public static int getMaxThreadSize(){
		return getProcessors() + 1;
	}
}
